<?php
	$arrQuestion	= $this->arrQuestion;
	$arrChoice	= $this->arrChoice;
	$numOfQuestion	= $this->numOfQuestion;
	$type1	= (int)($numOfQuestion/2);
	$type2	= (int)(($numOfQuestion - $type1)/2);
	$type3	= $numOfQuestion - $type1 - $type2;
?>
<h2 style="color: red; font-style: italic;">
	<label style="font-weight: normal; font-size: 17px; color: black;">Thời gian còn lại:</label>
	<span id="minute"><?php echo (int)($this->remainTime/60) ?></span>:
	<span id="second"><?php echo $this->remainTime%60 ?></span>
</h2>
<div class="exam_frame" style="font-size: 13px; font-weight: bold;">
	<form action="<?php echo $this->basePath();?>/student/finishexam/<?php echo $this->subjectID?>" method="post" name="exam">
	<?php
		for ($i=1; $i<=$numOfQuestion; $i++) {
			$label	= "Câu ".$i.":";
			$name	= "question".$i;
			if ($i<=$type1) {
	?>
				<label class="text-info"><?php echo $label?></label>
				<?php echo $arrQuestion[$i-1]?><br>
				<label class="choice"><input type="radio" name="<?php echo $name?>" value="1"> Đúng</label><br>
				<label class="choice"><input type="radio" name="<?php echo $name?>" value="0"> Sai</label><br>
				<br>
	<?php
			}
			else {
				$arr	= array('1'	=> $arrChoice[$i-$type1-1]->choice_1,
								'2'	=> $arrChoice[$i-$type1-1]->choice_2,
								'3'	=> $arrChoice[$i-$type1-1]->choice_3,
								'4'	=> $arrChoice[$i-$type1-1]->choice_4);
				if ($i<=$type1+$type2) {
	?>
				<label class="text-info"><?php echo $label?></label>
				<?php echo $arrQuestion[$i-1]?><span style="font-weight: normal; font-style: italic;"> (chọn hai đáp án)</span><br>
				<label class="choice"><input type="checkbox" name="<?php echo $name?>[]" value="1"> <?php echo $arr['1']?></label><br>
				<label class="choice"><input type="checkbox" name="<?php echo $name?>[]" value="2"> <?php echo $arr['2']?></label><br>
				<label class="choice"><input type="checkbox" name="<?php echo $name?>[]" value="3"> <?php echo $arr['3']?></label><br>
				<label class="choice"><input type="checkbox" name="<?php echo $name?>[]" value="4"> <?php echo $arr['4']?></label><br>
				<br>
	<?php
				}
				else {
	?>
					<label class="text-info"><?php echo $label?></label>
					<?php echo $arrQuestion[$i-1]?><br>
					<label class="choice"><input type="radio" name="<?php echo $name?>" value="1"> <?php echo $arr['1']?></label><br>
					<label class="choice"><input type="radio" name="<?php echo $name?>" value="2"> <?php echo $arr['2']?></label><br>
					<label class="choice"><input type="radio" name="<?php echo $name?>" value="3"> <?php echo $arr['3']?></label><br>
					<label class="choice"><input type="radio" name="<?php echo $name?>" value="4"> <?php echo $arr['4']?></label><br>
					<br>
	<?php
				}
			}
		}
	?>
		<p><input class="btn btn-success" onclick="return ConfirmSend()" type="submit" name="btn_submit" id="btn_submit" value="Nộp bài"></p>
	</form>
</div>

<script type="text/javascript">
	$(document).ready(function() {
		start(minute, second);
	});
	window.history.forward();
	var minute	= '<?php echo (int)($this->remainTime/60) ?>';
	var second	= '<?php echo $this->remainTime%60 ?>';
</script>